import { Graph } from '@antv/x6'
import { create } from "zustand"
type Nullable<T> = T | null;
export interface GraphState {
  graph: Nullable<Graph>;
  setGraph: (graph: Graph) => void;
  getGraph: () => Graph | null;
  clearGraph: () => void;
}
const useGraph = create<GraphState>((set, get) => ({
  graph: null,
  setGraph: (graph: Graph) => set({ graph }),
  getGraph: () => get().graph,
  clearGraph: () => set({ graph: null })
}))
export default useGraph;
